//获取柱状图的数据
import { ColumnLineChartlList } from '@/services/ColumnLineChart';
import { useEffect, useState } from 'react';

type columnLineChart = {
  time: string;
  '价值/千亿元': number;
  增长幅度: number;
};

const useColumnLineChart = (): columnLineChart[] => {
  const [columnLineChartList, setColumnLineChartList] = useState<
    columnLineChart[]
  >([]);
  useEffect(() => {
    const fetchData = async () => {
      try {
        const res = await ColumnLineChartlList();
        if (res.success) {
          console.log('columnLineChartData:', res.data.columnLineChart);
          setColumnLineChartList(res.data.columnLineChart);
        }
      } catch (error) {
        console.error('Error fetching ColumnLineChart data:', error);
      }
    };

    fetchData();
  }, []);

  return columnLineChartList;
};

export default useColumnLineChart;
